package me.chan.functional;

import java.util.function.DoubleUnaryOperator;

public class CurriedFormatDemo {

	public static void main(String[] args) {
		double f1 = converter(36, 9.0/5, 32);
		DoubleUnaryOperator convertCtoF = curriedConverter(9.0/5, 32);
		double f2 = convertCtoF.applyAsDouble(36);
		System.out.println(f1==f2);
		System.out.println(f2);
	}

	static double converter(double x, double f, double b) {
		return x * f + b;
	}
	//curried formatted
	static DoubleUnaryOperator curriedConverter(double f, double b) {
		return x  -> (x*f+b);
	}
}
